const path = require('path');

function resolve(dir) {
    return path.join(__dirname,dir);
}

// vue.config.js是使用CMD语法
module.exports = {
    // 开发服务器(静态资源服务器)
    devServer: {
        open: true,
        //将所有'/api'开头的请求全部代理到http://39.98.123.211/
        proxy: {
            '/api': {
                target: 'http://39.98.123.211/',
            }
        }
    },

    // 关闭eslint校验,建议写完一个模块重新开启一下
    lintOnSave: false,

    // 编写webpack原生配置
    configureWebpack: {
        // 定义import规范
        resolve: {
            // 别名
            alias: {
                http: resolve('src/http'),
                mock: resolve('src/mock'),
                components: resolve('src/components'),
                pages: resolve('src/pages'),
                router: resolve('src/router'),
                routes: resolve('src/routes'),
                store: resolve('src/store'),
            }
        }
    }
};
